<?php
error_reporting(E_WARNING);
include_once 'includes/metodos.php';
checkUser();
connectSql();

$data_atual = date("Y-m-d");
$data_anterior = date("Y-m");
$data_anterior .= '-01';

$query = mysql_query("SELECT * FROM tb_agenda WHERE status=2 AND (data BETWEEN '$data_anterior' AND '$data_atual')");
$num_falta = mysql_num_rows($query);

$query = mysql_query("SELECT * FROM tb_agenda WHERE status=3 AND (data BETWEEN '$data_anterior' AND '$data_atual')");
$num_des = mysql_num_rows($query);

$query = mysql_query("SELECT * FROM tb_agenda WHERE status=1 AND (data BETWEEN '$data_anterior' AND '$data_atual')");
$num_marcado = mysql_num_rows($query);
?>
<a href="agenda/index.php">Agenda</a>
<a href="cliente/index.php">Cliente</a>
<?php 
$query = mysql_query("SELECT perfil FROM tb_usuario WHERE id=".$_SESSION['id']);
$row = mysql_fetch_array($query);
if($row['perfil']==1){ ?>
<div>
	<div style="border: solid #ccc; width: 238px; height: auto;">
		<?php echo 'Total de falta nesse m&eacute;s por clientes: '.$num_falta;?>
	</div><br>
	<div style="border: solid #ccc; width: 282px; height: auto;">
		<?php echo 'Total de dessistencia nesse m&eacute;s por clientes: '.$num_des;?>
	</div><br>
	<div style="border: solid #ccc; width: 282px; height: auto;">
		<?php echo 'Total de cliente esperando atendimento: '.$num_marcado;?>
	</div>
</div>
<?php 
}
?>